package cc.lucien.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/logout")
public class LogoutController {

    @GetMapping("/out")
    public String out(HttpSession session) {
        // 从 session 会话域中删除用户信息
        session.removeAttribute("admin");
        // 重定向到登录页面
        return "redirect:/login/toLogin";
    }
}
